/*********************************************************************************
 * 
 * Author: wujunjie
 * Create Date: 2014-05-10
 * Description:
 *          
 * Revision History:
 *      Date          Author               Description
 * 
*********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataFrameworkAccess;
using Xinkui.Entity.AutoGenerator;
using Xinkui.Common;
namespace Xinkui.DataAccess.AutoGenerator {
    public partial class CompanyInfoDataAccess {
        public List<CompanyInfo_Entity> ListCompanysByCategory(int pageIndex, int pageSize, int cateId, out int total) {
            total = 0;
            try {
                int tempRecord = 0;
                if (pageIndex <= 0) pageIndex = 1;
                DataCommand cmd = DataCommandManager.GetDataCommand("Query.Company.CatalogList");
                cmd.SetParameterValue("@where", WhereHelper.Company.CreateCatalogWhere(cateId));
                cmd.SetParameterValue("@PageSize", pageSize);
                cmd.SetParameterValue("@PageIndex", pageIndex);
                cmd.SetParameterValue("@RecordCount", tempRecord);
                List<CompanyInfo_Entity> pageList = cmd.ExecuteEntityList<CompanyInfo_Entity>();

                object cmdGetParameterValue = cmd.GetParameterValue("@RecordCount");
                if (!(cmdGetParameterValue is DBNull)) {
                    total = Convert.ToInt32(cmdGetParameterValue);
                }

                return pageList;
            }
            catch (Exception ex) {
                ExceptionHelper.ProcessException(ex);
            }

            return new List<CompanyInfo_Entity>(0);

        }

        public List<CompanyCertificateMaintain_Entity> CompanyCertificateMaintain_ListByCompany(int companyid, int pageSize, int pageIndex, out int total) {
            total = 0;
            try {
                int tempRecord = 0;
                DataCommand cmd = DataCommandManager.GetDataCommand("CompanyCertificateMaintain_ListByCompany");
                cmd.SetParameterValue("@PageSize", pageSize);
                cmd.SetParameterValue("@PageIndex", pageIndex);
                cmd.SetParameterValue("@CompanyId", companyid);
                cmd.SetParameterValue("@RecordCount", tempRecord);
                List<CompanyCertificateMaintain_Entity> pageList = cmd.ExecuteEntityList<CompanyCertificateMaintain_Entity>();
                total = Convert.ToInt32(cmd.GetParameterValue("@RecordCount"));
                return pageList;
            }
            catch (Exception ex) {
                ExceptionHelper.ProcessException(ex);
            }

            return new List<CompanyCertificateMaintain_Entity>(0);

        }
    }




}
